<?php

?>
<!-- layout::Admin:iframe/header::$tpl_cache_date -->

<!-- Start Page Header -->
<div id="page-header">
    <h1><?=$title?></h1>
</div>
<!-- End Page Header -->

<!-- Start Grid -->
<div class="container_12">

<!-- Show Message -->
<div id="message_block"></div>

<!-- Start Forms -->
<div class="grid_12">
  <div class="box-header"> 会员资料 </div>
  <div class="box">
    <form method="post" action="<?=U('member/add')?>" id="add_form">
      <div class="row">
        <label>用户名</label>
        <input type="text" name="name" id="formid_name" />
      </div>
      <div class="row">
        <label>密码</label>
        <input type="password" name="password" id="formid_password" />
      </div>
      <div class="row">
        <label>Email</label>
        <input type="text" name="email" id="formid_email" />
      </div>
      <div class="row">
        <label>角色</label>
        <select name="role" id="formid_role">
          <optgroup label="管理组">
          <option>超级管理员</option>
          <option>信息录入</option>
          <option>审核人员</option>
          </optgroup>
        </select>
      </div>
      <div class="row">
        <label>备注信息</label>
        <textarea name="text area" rows="6" cols="34"></textarea>
      </div>
      <div class="row">
        <label></label>
        <input type="submit" value="添加" class="button" />
        <input type="reset" value="重置" class="button" />
      </div>
    </form>
  </div>
</div>
<!-- Start Forms -->

<!-- End Grid -->
</div>
<!-- End Page Content -->

<script type="text/javascript">
    $("#add_form").submit(function(){
        var form_val = $(this).serialize();
        var form_action = $(this).attr("action");
        var name = $("#formid_name").val();
        var password = $("#formid_password").val();
        var email = $("#formid_email").val();

        /* 表单验证 */
        if(name == '') {
           return msg('用户名不能为空!', 'error', '#formid_name');
        } else if(password == '') {
            return msg('密码不能为空!', 'error', '#formid_password');
        } else if(email == '') {
            return msg('Email 不能为空!', 'error', '#formid_email');
        } else {
            $("#message_block").empty();
        }

        /* ajax 请求 */
        $.ajax({
            type: "POST",
            url: form_action,
            data: form_val,
            dataType: 'json',
            success: function(data){
                //if(data.data) {

                    //return msg();
                //}
            }
        });
        return false;
    });
</script>

<!-- layout::Admin:iframe/footer::$tpl_cache_date -->